﻿@model RecipientInfoIM

@using (Ajax.BeginForm("Edit", "RecipientInfo",
                            new AjaxOptions()
                            {
                                HttpMethod = "POST",
                                OnBegin = "onBegin",
                                OnComplete = "onComplete",
                                OnSuccess = "updateSuccess",
                                //OnFailure = "handleError",
                                //  UpdateTargetId = "RoleList"

                            }, new { @class = "form-horizontal", role = "form" }))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)
    @Html.HiddenFor(model => model.Id)

    <!-- 添加菜单 Modal -->
    <div class="modal fade" id="ModalEdit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">编辑分类</h4>
                </div>
                <div class="modal-body">

                    <div class="form-group">
                        @Html.LabelFor(model => model.ProvinceId, new { @class = "col-md-2 control-label" })
                        <div class="col-md-10">
                            @Html.DropDownListFor(model => model.ProvinceId, (SelectList)ViewBag.Provinces, $"--选择{Labels.Province}--", new { @class = "form-control", placeholder = Labels.Province })
                            @Html.ValidationMessageFor(model => model.ProvinceId)
                        </div>

                    </div>

                    <div class="form-group">
                        @Html.LabelFor(model => model.CityId, new { @class = "col-md-2 control-label" })
                        <div class="col-md-10">
                            @Html.DropDownListFor(model => model.CityId, (SelectList)ViewBag.Cities, $"--选择{Labels.City}--", new { @class = "form-control", placeholder = Labels.City })
                            @Html.ValidationMessageFor(model => model.CityId)
                        </div>
                    </div>


                    <div class="form-group">
                        @Html.LabelFor(model => model.DistrictId, new { @class = "col-md-2 control-label" })
                        <div class="col-md-10">
                            @Html.DropDownListFor(model => model.DistrictId, (SelectList)ViewBag.Districts, $"--选择{Labels.District}--", new { @class = "form-control", placeholder = Labels.District })
                            @Html.ValidationMessageFor(model => model.DistrictId)
                        </div>
                    </div>

                    <div class="form-group">
                        @Html.LabelFor(model => model.Address, new { @class = "col-md-2 control-label" })
                        <div class="col-md-10">
                            @Html.TextBoxFor(model => model.Address, new { @class = "form-control", placeholder = Labels.Address })
                            @Html.ValidationMessageFor(model => model.Address)
                        </div>
                    </div>

                    <div class="form-group">
                        @Html.LabelFor(model => model.Postcode, new { @class = "col-md-2 control-label" })
                        <div class="col-md-10">
                            @Html.TextBoxFor(model => model.Postcode, new { @class = "form-control", placeholder = Labels.Postcode })
                            @Html.ValidationMessageFor(model => model.Postcode)
                        </div>
                    </div>

                    <div class="form-group">
                        @Html.LabelFor(model => model.Recipient, new { @class = "col-md-2 control-label" })
                        <div class="col-md-10">
                            @Html.TextBoxFor(model => model.Recipient, new { @class = "form-control", placeholder = Labels.Recipient })
                            @Html.ValidationMessageFor(model => model.Recipient)
                        </div>
                    </div>
                    <div class="form-group">
                        @Html.LabelFor(model => model.Mobile, new { @class = "col-md-2 control-label" })
                        <div class="col-md-10">
                            @Html.TextBoxFor(model => model.Mobile, new { @class = "form-control", placeholder = Labels.Mobile })
                            @Html.ValidationMessageFor(model => model.Mobile)
                        </div>
                    </div>
                    <div class="form-group">
                        @Html.LabelFor(model => model.Phone, new { @class = "col-md-2 control-label" })
                        <div class="col-md-10">
                            @Html.TextBoxFor(model => model.Phone, new { @class = "form-control", placeholder = Labels.Phone })
                            @Html.ValidationMessageFor(model => model.Phone)
                        </div>
                    </div>

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button class="btn btn-primary" type="submit" id="btnSave"><i class="fa fa-save fa-fw"></i>保存</button>
                </div>
            </div>
        </div>
    </div>
}

<script type="text/javascript" language=javascript>
    $.validator.unobtrusive.parse(document);
</script>